﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoVanHocTapData.Interface;
using CoVanHocTapData.Entities;

namespace CoVanHocTapData.Concretes
{
    public class NganhDaoTao2Repository:INganhDaoTao2Repository
    {
        #region property
        DangKyPhuEntities entities;
        #endregion

        #region constructor
        public NganhDaoTao2Repository()
        {
            entities = new DangKyPhuEntities();
        }
        #endregion

        #region INganhDaoTao2Repository Members

        public IQueryable<Entities.NganhDaoTao2> LayTatCaTheoSinhVien(Entities.SinhVien sv)
        {
            return (from m in entities.NganhDaoTao2
                        join n in entities.SinhVienKhois
                            on m.MaKhoi equals n.KhoiID                            
                        where n.MSSV.Equals(sv.MSSV) && m.He.Equals(sv.Lop.HeDaoTaoID)
                        select m);
        }

        #endregion
    }
}
